﻿@model OrchardCore.Users.ViewModels.ChangePasswordViewModel

@{
  ViewLayout = "Layout__Login";

  ViewData.ModelState.TryGetValue("CurrentPassword", out var currentPassword);
  ViewData.ModelState.TryGetValue("Password", out var password);
  ViewData.ModelState.TryGetValue("PasswordConfirmation", out var passwordConfirmation);
}
<form asp-controller="Account" asp-action="ChangePassword" asp-route-returnurl="@ViewData["ReturnUrl"]" method="post">
  <v-card class="px-4">
    <v-card-title>@T["Change password"]</v-card-title>
    <v-card-text>
    @if (ViewData.ModelState.ErrorCount > 0)
    {
      <v-alert color="red" type="error">
        @foreach (var error in ViewData.ModelState.SelectMany(x => x.Value.Errors).Reverse())
        {
          <span>@error.ErrorMessage</span>
        }
      </v-alert>
    }
    <v-row>
      <v-col cols="12">
        <v-text-field id="CurrentPassword" type="password" name="CurrentPassword" label="@T["Current password"]" error-messages="@(currentPassword?.Errors.FirstOrDefault()?.ErrorMessage)"></v-text-field>
          <v-text-field id="Password" type="password" name="Password" label="@T["New password"]" error-messages="@(password?.Errors.FirstOrDefault()?.ErrorMessage)"></v-text-field>
          <v-text-field id="PasswordConfirmation" type="password" name="PasswordConfirmation" label="@T["New password confirmation"]" error-messages="@(passwordConfirmation?.Errors.FirstOrDefault()?.ErrorMessage)"></v-text-field>
        </v-col>
      </v-row>
    </v-card-text>
    <v-card-actions>
      <v-btn type="submit" x-large block color="success">@T["Change password"]</v-btn>
    </v-card-actions>
  </v-card>
</form>


